# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=bladerf
pkgver=2021.10
pkgrel=0
pkgdesc="Host-side libraries, drivers and utilities for bladeRF platform"
url="https://github.com/Nuand/bladeRF"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT"
makedepends="cmake samurai libusb-dev"
subpackages="$pkgname-dev $pkgname-libs"
_noosref="0bba46e6f6f75785a65d425ece37d0a04daf6157"
source="https://github.com/Nuand/bladeRF/archive/refs/tags/$pkgver/bladerf-$pkgver.tar.gz
	https://github.com/analogdevicesinc/no-OS/archive/$_noosref/no-OS-$_noosref.tar.gz
	"
builddir="$srcdir/bladeRF-$pkgver"
options="!check"

prepare() {
	default_prepare
	mv "$srcdir"/no-OS-$_noosref/* thirdparty/analogdevicesinc/no-OS/
}

build() {
	cmake -G Ninja -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DTAGGED_RELEASE=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
7a348ecb15464d2676c685a072c18aff3e98dd1d8f43727ee8e20b664c55ed5d22f35a01bbd3dfc95d7268cb1f6b467bffae2d40e9120c8c02545b047f660cef  bladerf-2021.10.tar.gz
cf6f6d34fed9879ae7263782f20f33dd3af84201e3477fa0501e072eb08a8a545a07c496ad0ff3f7dc1a6ef407f136f843ba05942b4819e146c5fef023a3bb02  no-OS-0bba46e6f6f75785a65d425ece37d0a04daf6157.tar.gz
"
